import * as types from "../types/recyclePriceInfoTypes";

const initialState = {
  loading: false,
  initing: true,
  error: undefined,
  priceInfo: [],
};

export default function recyclePriceInfoReducer(state = initialState, action) {
  switch (action.type) {
    case types.RECYCLEPRICEINFO_INITING:
      return {
        ...state,
        initing: true,
      };
    case types.RECYCLEPRICEINFO_DONE:
      return {
        ...state,
        initing: false,
        loading: false,
        priceInfo: action.priceInfo,
      };
    case types.RECYCLEPRICEINFO_ERROR:
      return {
        ...state,
        initing: false,
        loading: false,
        error: action.error,
      };
    case types.RECYCLEPRICEINFO_SERVICEINFOUNMOUNT:
      return {
        ...initialState,
      };
    default:
      return state;
  }
}
